
const { injectBabelPlugin } = require('react-app-rewired');
const rewireLess = require('react-app-rewire-less');
const path = require('path');


function resolve(dir) {
    return path.join(__dirname, '.', dir)
}

module.exports = function override(config, env) {

    config = injectBabelPlugin(
        ['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }],
        config,
    );
    config = rewireLess.withLoaderOptions({
        modifyVars: { "@primary-color": "#1DA57A" },
        javascriptEnabled: true,
    })(config, env);

    config.resolve.alias = {
        'components': resolve('src/components'),
        'pages': resolve('src/pages'),
        'service': resolve('src/service'),
        'style': resolve('src/style'),
        'config': resolve('src/config'),
        'utils': resolve('src/utils'),
    };

    return config;
};